package com.sz.designpattern.create5.singleton.container;

import java.util.HashMap;
import java.util.Map;

//非线程安全
//safe使用ConcurrentHashMap
public class SingletonManager {

    private static Map<String,Object> map = new HashMap<>();

    public static void registerService(String key,Object obj){
        if (!map.containsKey(key)){
            map.put(key,obj);
        }
    }

    public static Object getService(String key){
        return map.get(key);
    }
}
